{include file="public/header"}
<title>问题列表</title>
</head>
<body>
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i> 首页
    <span class="c-gray en">&gt;</span> 远程沟通
    <span class="c-gray en">&gt;</span> 远程沟通列表
    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
    <a style="text-decoration:none" class="btn btn-primary ad" data-id="0" href="javascript:;" title="新增"><span class="label label-primary">新增</span></a>
    <div class="mt-20">
        <div class="title-border">
            <div class="flex1">序号</div>
            <div class="flex1">分类标题</div>
            <div class="flex2">操作</div>
        </div>
        {volist name='data' id='vo'}
        <div class="content-border">
            <div class="flex1">{$vo.id}</div>
            <div class="flex1">{$vo.title}</div>
            <div class="flex2">
                <a class="ch-button ch-blue edit" data-id="{$vo.id}" href="javascript:;" title="编辑">编辑</a>
                <a class="ch-button ch-gray info" data-id="{$vo.id}" href="javascript:;" title="查看下一级">查看下一级</a>
                <a class="ch-button ch-wathet ad" data-id="{$vo.id}" href="javascript:;" title="添加下级分类">添加下级分类</a>
                <a class="ch-button ch-red del" data-id="{$vo.id}" href="javascript:;" title="删除">删除</a>
            </div>
        </div>
        {/volist}
        <div class="pages" style="float: right">{$data->render()}</div>
    </div>
</div>

{include file="public/footer"}
<script type="text/javascript">
    var winWidth = $(window).width();
    var areaWidth = "";
    var areaHeight = "";
    /**
     * 添加分类
     */
    $('.ad').click(function () {
        if( winWidth > 768 ){
            areaWidth = "500px"
            areaHeight = "250px"
        } else {
            areaWidth = '90%'
            areaHeight = '300px'
        }
        var id=$(this).attr('data-id');
        var src="{:Url('index/config/remote_ad')}";
        layer.open({
            type: 2,
            area: [areaWidth,areaHeight],
            fix: false,
            maxmin: true,
            shade:0.4,
            title: '添加分类',
            content: src+'?id='+id
        });
    });


    /**
     * 删除
     */
    $('.del').click(function () {
        var id=$(this).attr('data-id');
        var obj={};
        obj.id=id;
        var src="{:Url('index/config/remote_de')}";
        layer.confirm('确认要删除吗？', function (index) {
            $.ajax({
                type: 'POST',
                url: src,
                dataType: 'json',
                data: obj,
                success: function (data) {
                    var res=JSON.parse(data);
                    if(res.code==200){
                        layer.msg(res.msg, {icon: 1, time: 2000}, function () {
                            setTimeout("window.location.reload()", 1);
                        });
                    }else{
                        layer.msg(res.msg,{icon: 5,time:1000});
                    }

                },
                error: function (data) {
                    console.log(data.msg);
                },
            });
        });
    });
    $('.info').click(function () {
        if( winWidth > 768 ){
            areaWidth = "900px"
            areaHeight = "700px"
        } else {
            areaWidth = '100%'
            areaHeight = '100%'
        }
        var id=$(this).attr('data-id');
        var src="{:Url('index/config/remote_info')}";
        layer.open({
            type: 2,
            area: [areaWidth,areaHeight],
            fix: false,
            maxmin: true,
            shade:0.4,
            title: '查看分类',
            content: src+'?id='+id
        });
    });
    $('.edit').click(function () {
        if( winWidth > 768 ){
            areaWidth = "500px"
            areaHeight = "250px"
        } else {
            areaWidth = '90%'
            areaHeight = '300px'
        }
        var id=$(this).attr('data-id');
        var src="{:Url('index/config/remote_edi')}";
        layer.open({
            type: 2,
            area: [areaWidth,areaHeight],
            fix: false,
            maxmin: true,
            shade:0.4,
            title: '编辑问题',
            content: src+'?id='+id+'&type=1 '
        });
    });

</script>
</body>
</html>